package verappdesktop.core;

import java.io.File;
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Scanner;

public class Main {
	//args[0] should be path to list of variable names/units.
	public static void main(String[] args) {
		Scanner sc = null;
		//Try to read list of variable names/units.
		try {
			sc = new Scanner(new File(args[0]));
		} catch (FileNotFoundException e) {
			e.printStackTrace();
			System.exit(1);
		}
		List<Variable> variables = new ArrayList<Variable>();
		String line;
		String[] words;
		while (sc.hasNextLine()){
			line = sc.nextLine();
			words = line.split(" ");
			if (words.length != 2){
				throw new IllegalArgumentException("List of variable names/units is invalid. Check the file!");
			}
			else {
				variables.add(new Variable(words[0],words[1]));
			}
		}
		new VerappDesktop("VerApp Desktop", variables);
		System.out.println("Intialized!");
	}
}
